package com.help10000.rms.mvp.presenter

import com.amir.common.api.CustomObserver
import com.amir.common.beans.MsgListWrapper
import com.amir.common.mvp.model.Model
import com.amir.common.mvp.presenter.BasePresenter
import com.amir.common.utils.Constant
import com.amir.common.utils.SPUtils
import com.help10000.rms.mvp.view.MessageDetailView

class MessageListPresenter(view: MessageDetailView) : BasePresenter<MessageDetailView>(view) {


    /**
     * 获取消息列表
     */
    fun getMessageList(msgType: Int, page: Int) {
        val AccessToken = SPUtils.getString(Constant.AccessToken)
        val updateNickname = Model.getServer().getMsgList(AccessToken, msgType, page)
        Model.getObservable(updateNickname, object : CustomObserver<MsgListWrapper>(mvpView) {

            override fun success(t: MsgListWrapper) {
                mvpView?.onDataSuccess(t.data)
            }
        })
    }
}